package com.txby.dplus.common.utils.util;

import java.util.UUID;

public class IdWorker {

    /**
     * 主机和进程的机器码
     */
    private static final Sequence worker = new Sequence();

    public static long getId() {
        return worker.nextId();
    }

    /**
     * <p>
     * 获取去掉"-" UUID
     * </p>
     */
    public static synchronized String get32UUID() {
        return UUID.randomUUID().toString().replace("-", "");
    }
    public static synchronized String get50UUID() {
    	String uid=UUID.randomUUID().toString().replace("-", "")+getId();
    	uid=uid.length()>50?uid.substring(0,50):uid;
        return uid;
    }
    public static synchronized String get51UUID() {
    	return UUID.randomUUID().toString().replace("-", "")+getId();
    }
    public static void main(String[] args) {
    	String uid=get32UUID();
		System.out.println(uid.length());
	}
    
}